#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>
using namespace std;

void process(int n, int k, vector<int> &nums, vector<vector<int>> &result, int j,int count)
{
    if (count == k)
    {
        result.push_back(nums);
    }
    for (int i = j; i <= n; i++)
    {
        nums[j-1] = i;
        process(n, k, nums, result, i + 1 , count+1);
    }
}

vector<vector<int>> _77(int n, int k)
{
    vector<vector<int>> result;
    vector<int> nums(k,0);
    process(n, k, nums, result, 1,0);
    
    return result;
}

int main()
{
    vector<vector<int>> result;
    result = _77(4,2);
    for (size_t i = 0; i < result.size(); i++)
    {
        for (size_t j = 0; j < result[0].size(); j++)
        {
            cout << result[i][j] << " ";
        }
        cout << endl;
    }
    return 0;
}